import request from "@/utils/request";

let cacheAllCostData = [];

export default {
  name: 'AllCostMixin',
  data(){
    return {
      allCostList: [],
    }
  },
  computed: {
    // 所有正常的成本
    costList(){
      return this.allCostList.filter(item => item.status === 1 && item.agentIds.length > 0)
    },
    // 空运成本
    airCostList(){
      return this.costList.filter(item => item.costType.includes('air'))
    },
    // 海运成本
    seaCostList(){
      return this.costList.filter(item => item.costType.includes('sea'))
    },
    // 海外仓成本
    HWCCostList(){
      return this.costList.filter(item => item.costType.includes('HWC'))
    },
  },
  created() {
    this.getAllCostList()
  },
  methods: {
    getAllCostList(){
      request({
        url: '/cost/getAllCost',
      })
        .then(res=>{
          this.allCostList = res.data
        })
    }
  }
}
